package org.adultedu.service.serviceimpl;

import org.adultedu.dao.CourseMapper;
import org.adultedu.pojo.Course;
import org.adultedu.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Transactional
@Service("CourseServiceImpl")
public class CourseServiceImpl implements CourseService {
    @Autowired
    private CourseMapper courseMapper;
    public List<Course> queryAllCourse() {
        return courseMapper.queryAllCourse();
    }


    public List queryCourse(String cname, Integer cvalue, Integer cnum, String level, String cway) {
        return courseMapper.queryCourse(cname,cvalue,cnum,level,cway);
    }

    public List queryUniqueCourse(String cname,Integer cvalue,Integer cnum,String level,String cway,Integer currentsize,Integer pagesize){
        return courseMapper.queryUniqueCourse(cname,cvalue,cnum,level,cway,currentsize ,pagesize);
    }


    public Integer queryCoursePage(String cname, Integer cvalue, Integer cnum, String level, String cway) {
        return courseMapper.queryCoursePage(cname,cvalue,cnum,level,cway);
    }

    public List queryTeacherCourse(String tid) {
        return courseMapper.queryTeacherCourse(tid);
    }

    @Override
    public int updatePic(String url,String cid) {
        return courseMapper.updatePic(url,cid);
    }

    public int updateCourse(Course course) {
        return courseMapper.updateCourse(course);
    }

    public int insertCourse(Map course) {
        return courseMapper.insertCourse(course);
    }

    public int deleteCourse(String cid) {
        return courseMapper.deleteCourse(cid);
    }

    @Override
    public List getSalesPreview(String tid) {
        return courseMapper.getSalesPreview(tid);
    }

    @Override
    public Integer getSalesNumber(String tid) {
        return courseMapper.getSalesNumber(tid);
    }

    @Override
    public List getStudentCourse(String sid) {
        return courseMapper.getStudentCourse(sid);
    }
}
